
#ifndef __OLED_H
#define __OLED_H			  	 

  

#define OLED_CMD  0	//写命令
#define OLED_DATA 1	//写数据
#define OLED_MODE 0

#define OLED_DC_SET()  GPIO_WriteBit(GPIOB, GPIO_Pin_2, Bit_SET)
#define OLED_DC_CLR()  GPIO_WriteBit(GPIOB, GPIO_Pin_2, Bit_RESET)

#define OLED_CS_SET()  GPIO_WriteBit(GPIOC, GPIO_Pin_13, Bit_SET)
#define OLED_CS_CLR()  GPIO_WriteBit(GPIOC, GPIO_Pin_13, Bit_RESET)

#define OLED_RST_SET()  GPIO_WriteBit(GPIOD, GPIO_Pin_4, Bit_SET)
#define OLED_RST_CLR()  GPIO_WriteBit(GPIOD, GPIO_Pin_4, Bit_RESET)



//OLED模式设置
//0:4线串行模式
//1:并行8080模式

#define SIZE 16
#define XLevelL		0x02
#define XLevelH		0x10
#define Max_Column	128
#define Max_Row		64
#define	Brightness	0xFF 
#define X_WIDTH 	128
#define Y_WIDTH 	64	 
#define OLED_W   	X_WIDTH
#define OLED_H		Y_WIDTH		
#define GRAM_H 		OLED_H/8
#define OLED_UNFILLED			0
#define OLED_FILLED				1
					   

//void delay_ms(unsigned int ms);

//extern uint8_t OLED_GRAM[OLED_W][GRAM_H];
 		     
  
void oledDisplayOn(void);
void oledDisplayOff(void);	   							   		    
void oled_Init(void);
void oled_Clear(void);
void oled_DrawPoint(int16_t X, int16_t Y, uint8_t IsFilled);
void OLED_DrawLine(u8 x0, u8 y0, u8 x1, u8 y1, u8 t);
void OLED_DrawRectangle(int16_t X, int16_t Y, uint8_t Width, uint8_t Height, uint8_t IsFilled);
void OLED_Update(void);
void OLED_ClearArea(uint8_t x, uint8_t y, uint8_t width, uint8_t height);
void Clear_OLED_GRAM();








void oled_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
void oled_ShowChar(u8 x,u8 y,u8 chr);

void oled_ShowNum(u8 x, u8 y, u32 num, u8 len, u8 size2);

void oled_ShowString(u8 x,u8 y, u8 *p);	 
void oled_Set_Pos(unsigned char x, unsigned char y);
void oled_ShowCHStr(unsigned char X , unsigned char Y, unsigned char *pstr);
void oled_DrawBMP(unsigned char xs, unsigned char ys, unsigned char xw, unsigned char yh, const unsigned char BMP[]);
#endif  
	 



